/*
 * Depstruct.h
 *
 *  Created on: Dec 18, 2014
 *      Author: Phong
 */

#ifndef DEPSTRUCT_H_
#define DEPSTRUCT_H_

#include <vector>
#include <string>
#include "Dictionary.h"
#include "SafeShare.h"

using namespace std;

class Deptree;

struct DEP {
	int id;
	string word;
	string pos;
	int headid;
	string deprel;

	DEP() {}

	DEP(int iid, string &iword, string &ipos, int iheadid, string &ideprel) {
		id = iid;
		word = iword;
		pos = ipos;
		headid = iheadid;
		deprel = ideprel;
	}

	string toString() {
		return to_string(id) + "\t" + word + "\t" + pos + "\t" + to_string(headid) + "\t" + deprel;
	}
};

class Depstruct : public SafeShare {
public:

	int nWords;
	int *word, *pos, *head, *deprel, *nDeps;
	int** dep;
	
	vector<string> tokens;
	
	Depstruct(int** input, int n, vector<string>& tks);

	static Depstruct* create(DEP* deps, int n, Dictionary* vocaDic, Dictionary* posDic, Dictionary* deprelDic);

	Deptree* toDepTree();

	string toString(Dictionary* posDic, Dictionary* deprelDic);

	int toDepTree(int id, int node, Deptree* tree);
	
protected:
	virtual ~Depstruct();
};

#endif /* DEPSTRUCT_H_ */
